Skip to content

feat(extensions): add static external Hook catalog - #1716

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/external-hook-catalog
Jul 23, 2026
Merged

feat(extensions): add static external Hook catalog#1716
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/external-hook-catalog

Conversation

@limityan

@limityan limityan commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a versioned, runtime-free external Hook catalog for OpenCode, Claude Code, and Codex
  • inspect native configuration through bounded ecosystem adapters without importing modules, loading handlers, or executing Hook code
  • expose one shared read-only snapshot through Desktop settings and the established TUI /hooks flow
  • keep Server, Mobile, Remote, Peer, SDK, runtime Host, Node/Bun execution, permissions, and Hook invocation outside this PR

Architecture and ownership

Layer Responsibility in this PR
product-domains runtime-free v1 DTOs, validation/redaction rules, and the capability-specific provider port
static-hook-support bounded file/JSON/TOML parsing and bounded project-ancestor primitives; no ecosystem policy
ecosystem adapters native source precedence, schema interpretation, projection, stable identities, and ecosystem diagnostics
assembly/external-sources provider-neutral aggregation, failed/stale facts, last-valid retention, and deterministic provider order
assembly/core local execution-domain gating, Git/worktree topology, the existing discovery lane, refresh publication gate, and bounded workspace cache
CLI/Desktop/Web read-only host projection; no filesystem discovery or lifecycle policy in UI code

The catalog does not share DTOs with executable Hook or SDK work. It contains no handler body, command, prompt, URL, environment value, credential, or other executable payload. Only semantically equivalent tool-before/tool-after events map to reviewed BitFun Hook points; other native events stay native_only, and computed or unresolved registrations stay opaque.

OpenCode inspection uses OXC only as a syntax parser. It never imports JS/TS. Named, destructured, specifier, value re-export, type-only, ambient, and declaration-file cases have explicit behavior; .d.ts files are not runtime plugin sources. Claude Code applies disableAllHooks only after observed settings layers are combined. Codex linked-worktree project Hook declarations resolve to the primary checkout, honor persisted project-root markers, and keep effective command activation unknown because session flags and trust are not observable statically.

Product behavior

  • /hooks, /help hooks, /hooks -h, and /hooks --help follow the existing slash-command/help conventions; no Hook-specific namespace or shortcut is added
  • normal command registration and the existing collision menu own any name conflict; the Hook feature does not introduce another router
  • Desktop and TUI distinguish pending, successful empty, initial provider failure, stale last-valid data, partial diagnostics, and unsupported execution domains
  • interrupted Desktop polling becomes an explicit retryable terminal state instead of displaying an endless spinner or a false empty result
  • Remote workspace and Peer Device Mode fail closed with a clear unsupported state and never fall back to scanning the controller machine
  • users continue editing native configuration in the source product

Concurrency, safety, and limits

Repeated refreshes reuse the existing in-flight discovery instead of queuing successor generations. Initial cache-only access starts discovery, deferred timeout completion is finalized under the existing publication gate, and provider failures cannot overwrite healthy providers.

Boundary Limit / behavior
config and settings files 1 MiB per file
OpenCode plugin files 512 KiB each; 128 files; 1024 directory entries; 128 package declarations
adapter traversal at most 32 project ancestors
parsed Hook facts at most 2048 handlers/entries per provider
catalog contract 2048 sources and 2048 entries per provider; bounded diagnostics
Web transport/projection strict v1 parsing, 8192 catalog items; initial pages of 20 sources, 100 entries, and 20 diagnostics
TUI output per-provider caps of 10 sources, 100 entries, and 20 diagnostics
Core cache 32 workspaces with locked LRU allocation

Unknown enum values, duplicate identities, malformed source references, invalid status sets, and executable fields fail closed at the Web boundary.

Independent review

Three isolated reviews covered architecture/ownership, product behavior, and implementation/concurrency. Findings were fixed before this update, including discovery coalescing, initial/failed/stale UX, strict DTO validation, Codex worktree/root/activation semantics, Claude layered disable behavior, stable OpenCode export identities, type-only/ambient/.d.ts handling, bounded output, and stale owner comments. Final reviewers reported no remaining actionable findings.

Verification

  • cargo check --workspace
  • shared parser tests: 12 passed
  • Claude Code Hook adapter: 5 passed
  • Codex Hook adapter: 11 passed
  • OpenCode Hook adapter: 19 passed
  • Hook coordinator: 5 passed
  • generic refresh concurrency tests: 5 passed
  • Core external Hook assembly/cache tests: 5 passed
  • CLI Hook command/help/output tests: 7 passed
  • focused Web API/settings tests: 65 passed
  • pnpm run type-check:web
  • pnpm run lint:web
  • pnpm run i18n:audit
  • node scripts/check-core-boundaries.mjs
  • pnpm run check:repo-hygiene
  • pnpm run check:github-config
  • git diff --check

Known output is limited to pre-existing dependency deprecation and Windows linker messages; this PR adds no new warning class.

@limityan
limityan force-pushed the yanzhn/external-hook-catalog branch from c2dd31c to 8ab5f14 Compare July 23, 2026 10:10
Add runtime-free OpenCode, Claude Code, and Codex discovery behind shared contracts and bounded parsers. Expose the read-only catalog through TUI and Desktop settings with explicit remote gating.
@limityan
limityan force-pushed the yanzhn/external-hook-catalog branch from 8ab5f14 to d33f62b Compare July 23, 2026 13:35
@limityan
limityan merged commit b770f03 into GCWing:main Jul 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant